<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('项目合同列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">项目合同</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li hidden>
                                <label>合同名称：</label>
                                <input type="text" name="pName"/>
                            </li>
                            <li hidden>
                                <label>合同方：</label>
                                <input type="text" name="pContractor"/>
                            </li>
                            <li hidden>
                                <label>金钱：</label>
                                <input type="text" name="pMoney"/>
                            </li>
<!--                            <li class="select-time">-->
<!--                                <label>创建日期：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPCreate]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPCreate]"/>-->
<!--                            </li>-->
                            <li>
                                <label>建筑名称：</label>
                                <input type="text" name="pName"/>
                            </li>
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('ruoyi:files:detail')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:contract:remove')}]];
        var creadFlag = [[${@permission.hasPermi('ruoyi:contract:add')}]];
        var prefix = ctx + "ruoyi/contract";
        var prefixs = ctx + "system/building";
        var profiles = ctx + "ruoyi/files";

        $(function() {
            var options = {
                url: prefixs + "/list",
                createUrl: prefix + "/add/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: profiles +"/files/{id}",
                modalName:"",
                showColumns: false,
                detailView: true,
                mobileResponsive: false,
                cardView: true,
                onLoadSuccess: onLoadSuccess,
                onExpandRow: function (index, row, $detail) {
                    initChildTable(index, row, $detail);
                },
                columns: [
                    {
                        field: 'pId',
                        title: '项目id',
                        visible: false
                    },

                {
                    field: 'pFounder',
                    title: '创建者',
                },
                {
                    field: 'pName',
                    title: '建筑名称'
                },
                {
                    field: 'pTime',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.pId + '\')"><i class="fa fa-add"></i>添加</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        initChildTable = function (index, row, $detail) {
            var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
            $(childTable).bootstrapTable({
                url: prefix + "/listss",
                updateUrl: prefix + "/edit/{id}",
                method: 'post',
                sidePagination: "server",
                contentType: "application/x-www-form-urlencoded",
                queryParams: {
                    sId:row.pId
                },
                columns: [

                    {
                        field: 'pId',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'pName',
                        title: '合同名称',
                    },
                    {
                        field: 'pContractor',
                        title: '合同方',
                    },
                    {
                        field: 'pMoney',
                        title: '金钱',
                    },
                    {
                        field: 'pCreate',
                        title: '创建日期',
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, rows, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + rows.pId + '\')"><i class="fa fa-search"></i>添加文件</a> ');
                            return actions.join('');
                        }
                    }]
            });
        };
        function onLoadSuccess() {
            $(".fixed-table-body").on("scroll",function(){
                var sl=this.scrollLeft;
                $(this).next()[0].scrollLeft = sl;
            })
        }
    </script>
</body>
</html>